package com.ztsoft.user.pojo.entity.dynamic;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ztsoft.user.pojo.entity.user.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 表单明细
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_form_detail")
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class FormDetail extends BaseEntity {
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;// '主键'
    //动态表单id
    private String dynamicFormId;
    //左边显示的
    private String label;
    //字段key
    private String model;
    //提示
    private String placeholder;
    //类型
    private String type;
    //是否选择改变触发事件
    private Boolean isSelectChange;
    //默认值
    private String defaultValue;
    //顺序
    private Integer sequence;
    //描述
    private String describes;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 修改时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date modifyTime;
    /**
     * 创建id
     */
    private String createId;
    /**
     * 修改id
     */
    private String modifyId;
    /**
     * 是否删除
     */
    private Integer isDelete;

    //可能存在的数据
    @TableField(exist = false)
    private List<String> formDataList = new ArrayList<>();
    //验证条件
    @TableField(exist = false)
    private List<SearchVerify> verifyList = new ArrayList<>();
}